package com.yunhe.abnormal.consts;

import com.yunhe.common.constant.CacheConsts;
import com.yunhe.common.constant.LanguageConsts;
import com.yunhe.common.model.PageParam;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class AlarmStatusKey {

    public static String getKey(List<Long> stationIds,
                                String queryStr,
                                PageParam pageParam,
                                String language) {
        List<String> keyList = new ArrayList<>();
        if (stationIds != null) {
            keyList.add("stationIds" + CacheConsts.SPLIT_FIELD + stationIds);
        }
        if (queryStr != null) {
            keyList.add("queryStr" + CacheConsts.SPLIT_FIELD + queryStr);
        }
        if (pageParam != null) {
            keyList.add("ppo" + CacheConsts.SPLIT_FIELD + pageParam.toString());
        }
        if (language != null) {
            keyList.add("lan" + CacheConsts.SPLIT_FIELD + language);
        } else {
            keyList.add("lan" + CacheConsts.SPLIT_FIELD + LanguageConsts.TYPE.ZH.value());
        }
        return StringUtils.join(keyList, CacheConsts.SPLIT_TYPE);
    }
}
